﻿using System;
using System.Collections.Generic;
using NUnit.Framework;
using SimpleCheckout;

namespace SimpleCheckout.Specs
{
	[TestFixture]
	public class CheckoutSpec
	{
		[Test]
		public void ShouldCalculateTotals_WhenSimilarItemsAreScanned()
		{
			Dictionary<string, int> saleRules = new Dictionary<string, int>();
			PricingRules pricingRules = new PricingRules(saleRules);
			Checkout co = new Checkout(pricingRules);
			Item itemA = new Item{Sku="A", Price=50};
			co.Scan(itemA);
			co.Scan(itemA);
			co.Scan(itemA);			
			co.GetTotal().Should().Be.EqualTo(150);
		}
		
		[Test]
		public void ShouldCalculateTotals_WhenDifferentItemsNotOnSaleAreScanned() {
			Dictionary<string, int> saleRules = new Dictionary<string, int>();
			PricingRules pricingRules = new PricingRules(saleRules);
			Checkout co = new Checkout(pricingRules);
			Item itemA = new Item{Sku="A", Price=50};
			Item itemB = new Item{Sku="B", Price=30};
			co.Scan(itemA);
			co.Scan(itemB);
			co.Scan(itemA);			
			co.GetTotal().Should().Be.EqualTo(130);
		}
		
		public void ShouldUseSpecialPrice_WhenItemScannedIsOnSale() {
			
		}
	}
}
